<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<definitions name="Test Case"
                xmlns="http://www.omg.org/spec/CMMN/20151109/MODEL"
                xmlns:camunda="http://camunda.org/schema/1.0/cmmn"
                xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                targetNamespace="Examples">

  <case id="testCase" name="Test Case">

    <casePlanModel>

      <planItem definitionRef="decisionTask" id="PI_decisionTask" />
      <planItem definitionRef="collectDataStage" id="PI_collectDataStage" />
      <planItem definitionRef="dataCollectedMilestone"  id="PI_dataCollectedMilestone">
        <entryCriterion sentryRef="Sentry_1" />
      </planItem>
      <planItem definitionRef="decideHumanTask" id="PI_decideHumanTask">
        <entryCriterion sentryRef="Sentry_2" />
      </planItem>
      <planItem definitionRef="customerRetiredUserEvent" id="PI_customerRetiredUserEvent" />

      <sentry id="Sentry_1">
        <planItemOnPart sourceRef="PI_collectDataStage">
          <standardEvent>complete</standardEvent>
        </planItemOnPart>
      </sentry>

      <sentry id="Sentry_2">
        <planItemOnPart sourceRef="PI_dataCollectedMilestone">
          <standardEvent>complete</standardEvent>
        </planItemOnPart>
      </sentry>

      <sentry id="Sentry_3">
        <planItemOnPart sourceRef="PI_customerRetiredUserEvent">
          <standardEvent>complete</standardEvent>
        </planItemOnPart>
      </sentry>

      <stage autoComplete="false" name="Collect Data" id="collectDataStage">
        <planItem definitionRef="captureAppDataHumanTask" id="PI_captureAppDataHumanTask" />
        <planItem definitionRef="obtainCreditWorthinessCaseTask" id="PI_obtainCreditWorthinessCaseTask" />
        <planItem definitionRef="reviewDocumentsHumanTask" id="PI_reviewDocumentsHumanTask" />
        <planItem definitionRef="obtainSchufaInfoProcessTask" id="PI_obtainSchufaInfoProcessTask" />
        <planItem definitionRef="requestMissingDocumentsTask" id="PI_requestMissingDocumentsTask" />
      </stage>

      <processTask name="Obtain Schufa-Information" id="obtainSchufaInfoProcessTask" processRef="obtainSchufa" />

      <humanTask name="Decide About Loan Application" id="decideHumanTask" camunda:assignee="jonny1" />
      <humanTask name="Capture Application Data" id="captureAppDataHumanTask" camunda:assignee="jonny1" />
      <caseTask name="Obtain Credit-worthiness" id="obtainCreditWorthinessCaseTask" camunda:assignee="jonny1" />
      <task name="Request Missing Documents" id="requestMissingDocumentsTask"/>
      <humanTask name="Review Documents" id="reviewDocumentsHumanTask"/>
      <decisionTask name="Decide something" id="decisionTask"/>

      <milestone name="Data collected" id="dataCollectedMilestone" />

      <userEventListener name="Customer retired" id="customerRetiredUserEvent" />
      
      <exitCriterion sentryRef="Sentry_3" />

    </casePlanModel>

  </case>

</definitions>
